import request from '@/utils/request'
//这个页面主要是对接后端的接口
export default {
  // 员工列表（带条件分页查询）
  // page:当前页 limit:每页记录数
  selectByPage(page, limit) {
    return request({
      url: `/rbac/user/selectByPage?page=${page}&limit=${limit}`,
      method: 'get'
    })
  },
  deleteById(id) {
    return request({
      url: `/rbac/user/deleteById/${id}`,
      method: 'delete'
    })
  },
  add(user) {
    return request({
      url: `/rbac/user/add`,
      method: 'post',
      data: user
    })
  },
  selectById(id) {
    return request({
      url: `/rbac/user/selectById/${id}`,
      method: 'get',
    })
  },
  update(user) {
    return request({
      url: `/rbac/user/update`,
      method: 'put',
      data: user
    })
  }
}
export function login(data) {
  return request({
    url: '/rbac/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/rbac/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}
